<div class="mod_dialog_login mod_dialog_common">
<div class="settings_r">
    <div class="settings_in">
        <ul class="mod_form mod_form_normal input_long_per mod_form_low">
            <li class="control-group control-error">
                <label for="J_personal_name" class="item_l">登录邮箱：</label>
                <div class="controls">
                	figoisxjs@163.com
                    <input type="hidden" class="input" value="figoisxjs@163.com" name="userAccount" id="J_userAccount"/>
                </div>
            </li>
            <li class="control-group control-error">
                <label for="J_y_pass" class="item_l">原密码：</label>
                <div class="controls">
                    <input type="password" class="input" id="J_y_pass"  name="userPwd"/>
                    <span class="f_red m_l_12" id="J_y_pass_error"></span>
                </div>
            </li>
            <li class="control-group control-error">
                <label for="J_new_pass" class="item_l">新密码：</label>
                <div class="controls">
                    <input type="password" class="input" id="J_new_pass" />
                    <span class="f_red m_l_12" id="J_new_pass_error"></span>
                </div>
            </li>
            <li class="control-group control-error">
                <label for="J_new_pass_confirm" class="item_l">确认新密码：</label>
                <div class="controls">
                    <input type="password" class="input" id="J_new_pass_confirm" />
                    <span class="f_red m_l_12" id="J_new_pass_confirm_error"></span>
                </div>
            </li>
            <li class="inside">
                <p class="btn_box">
                    <button class="btn btn-red btn-padding-short" id="J_change_password">保 存</button>
                </p>
            </li>
        </ul>
    </div>
</div>
</div>

<script type="text/javascript">
	$(function(){
		$("#J_change_password").click(function(){
			var password = $.trim($("#J_y_pass").val());
			var newPassword = $.trim($("#J_new_pass").val());
			var newPasswordConfirm = $.trim($("#J_new_pass_confirm").val());
			var account = $.trim($("#J_userAccount").val())
			
			if(password==""||password==null){
				$("#J_y_pass_error").text("密码格式不正确！");
				return false;
			}
			
			if(newPassword.length>16||newPassword.length<6){
				$("#J_new_pass_error").text("密码长度为6-16位！");
				return false;
			}
			
			if(newPassword!=newPasswordConfirm){
				$("#J_new_pass_confirm_error").text("两次输入密码不一致！");
				return false;
			}else{
				$.post(
					"/my/checkpass/",
					{"userPwd":password,"newPwd":newPassword,"userAccount":account},
					function(data){
						if(!data.success){
						$("#J_y_pass_error").text("密码错误！");
							jAlert("密码错误!");
						}else{
							jAlert("修改密码成功!");
							$("input[type='password']").val("");
						}
					}
				,"json");
			}
			return false;
		})
		$("#J_y_pass").focus(function() {
				$("#J_y_pass_error").text("");
			});
		$("#J_new_pass").focus(function() {
				$("#J_new_pass_error").text("");
			});
		$("#J_new_pass_confirm").focus(function() {
				$("#J_new_pass_confirm_error").text("");
			});		
	});
</script>